package service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import dao.BaseDao;
import dao.ProductDao;
import service.ProductManager;
import vo.Base;
import vo.Product;
@Service(value="pm")
public class ProductManagerImpl implements ProductManager {
	@Autowired
	private ProductDao pd;
	@Autowired
	private BaseDao bd;
	@Override
	public List<Base> findAllBases() {
		
		return bd.findAllBases();
	}

	@Override
	public List<Product> findAllProducts() {
		// TODO Auto-generated method stub
		return pd.findAllProducts();
	}

	@Override
	public List<Product> findProductsByBaseId(String id) {
		// TODO Auto-generated method stub
		return pd.findProductsByBaseId(id);
	}
	@Transactional
	@Override
	public String addProduct(Product p) {
		// TODO Auto-generated method stub
		return pd.addProduct(p);
	}
	@Transactional
	@Override
	public String addBase(Base b) {
		// TODO Auto-generated method stub
		return bd.addBase(b);
	}
	@Transactional
	@Override
	public int deleteProduct(String id) {
		// TODO Auto-generated method stub
		return pd.deleteProduct(id);
	}
	@Transactional
	@Override
	public int deleteBase(String id) {
		// TODO Auto-generated method stub
		return bd.deleteBase(id);
	}

}
